package reflect;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Java 反射机制
 */
public class ReflectDemo01 {
    public static void main(String[] args) throws ClassNotFoundException {
        Scanner scanner = new Scanner(System.in);
        String className = scanner.nextLine();
        Class<?> c = Class.forName(className);
//        Class c = Executors.class;
        System.out.println(c.getName()); // 全限定名
        System.out.println(c.getSimpleName()); // 类名
        System.out.println(c.getPackage().getName()); // 包名

        Arrays.stream(c.getDeclaredMethods()).forEach(m -> System.out.println(m.getName()));

        Arrays.stream(c.getDeclaredFields()).forEach(f -> System.out.println(f.getName()));
    }
}
